﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MovingChameLibrary.Models
{
    public abstract class CommonItemModel : BindableBase
    {
        #region Constructor
        public CommonItemModel(int id, String title, String subtitle, byte[] imageStream)
        {
            this._id = id;
            this._title = title;
            this._subtitle = subtitle;

            this._imageSource = new ImageModel()
            {
                ImageType = ImageType.ServerImage,
                ImageStream = imageStream
            };

            ColSpan = 3;
            RowSpan = 3;
        }

        public CommonItemModel(int id, String title, String subtitle, string imagePath)
        {
            this._id = id;
            this._title = title;
            this._subtitle = subtitle;

            this._imageSource = new ImageModel()
            {
                ImageType = ImageType.LocalImage,
                ImagePath = imagePath
            };

            ColSpan = 3;
            RowSpan = 3;
        }
        #endregion

        #region Row Span - Column Span
        private int _colSpan = 1;
        public int ColSpan
        {
            get { return this._colSpan; }
            set { this._colSpan = value; }
        }

        private int _rowSpan = 1;
        public int RowSpan
        {
            get { return this._rowSpan; }
            set { this._rowSpan = value; }
        }
        #endregion

        #region Properties
        private int _id = -1;
        public int Id
        {
            get { return this._id; }
            set { this.SetProperty(ref this._id, value, "Id"); }
        }

        private string _title = string.Empty;
        public string Title
        {
            get { return this._title; }
            set { this.SetProperty(ref this._title, value, "Title"); }
        }

        private string _subtitle = string.Empty;
        public string Subtitle
        {
            get { return this._subtitle; }
            set { this.SetProperty(ref this._subtitle, value, "Subtitle"); }
        }

        private ImageModel _imageSource = null;
        public ImageModel ImageSource
        {
            get { return this._imageSource; }
            set { this.SetProperty(ref this._imageSource, value, "ImageSource"); }
        }
        #endregion
    }
}